package com.jplus.websocket;

import java.io.IOException;

public class MyClientApp {

    /**
     * 参数：
     * 0：表示群发
     * X：表示发送给id为 X 的用户
     * @throws IOException
     */
    public static void pushNewOrderToAllUser(MyClient client) throws IOException {

        String uri = "ws://120.79.241.167:8080/websocket/server";
        client.start(uri);
        client.sendMessage("有新订单发布|0|");
        // client.closeSocket();
    }

    public static void pushMyOrderModifyToUserId(String id) throws IOException {

        try {
            MyWebSocket myWebSocket = WebSocketMapUtil.get(id);
            myWebSocket.sendMessage("我的订单发生变更");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
